package jpa.entitys.promis.sales;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the BOOKING_INSTALLMENTS database table.
 * 
 */
@Embeddable
public class BookingInstallmentPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="DOCUMENT_TYPE", unique=true, nullable=false, length=2)
	private String documentType;

	@Column(name="BOOKING_SERIES", unique=true, nullable=false, length=4)
	private String bookingSeries;

	@Column(name="BOOKING_NUMBER", unique=true, nullable=false, precision=6)
	private long bookingNumber;

	@Column(name="INSTALLMENT_SEQ", unique=true, nullable=false, precision=8)
	private long installmentSeq;

    public BookingInstallmentPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getDocumentType() {
		return this.documentType;
	}
	public void setDocumentType(String documentType) {
		this.documentType = documentType;
	}
	public String getBookingSeries() {
		return this.bookingSeries;
	}
	public void setBookingSeries(String bookingSeries) {
		this.bookingSeries = bookingSeries;
	}
	public long getBookingNumber() {
		return this.bookingNumber;
	}
	public void setBookingNumber(long bookingNumber) {
		this.bookingNumber = bookingNumber;
	}
	public long getInstallmentSeq() {
		return this.installmentSeq;
	}
	public void setInstallmentSeq(long installmentSeq) {
		this.installmentSeq = installmentSeq;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof BookingInstallmentPK)) {
			return false;
		}
		BookingInstallmentPK castOther = (BookingInstallmentPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.documentType.equals(castOther.documentType)
			&& this.bookingSeries.equals(castOther.bookingSeries)
			&& (this.bookingNumber == castOther.bookingNumber)
			&& (this.installmentSeq == castOther.installmentSeq);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.documentType.hashCode();
		hash = hash * prime + this.bookingSeries.hashCode();
		hash = hash * prime + ((int) (this.bookingNumber ^ (this.bookingNumber >>> 32)));
		hash = hash * prime + ((int) (this.installmentSeq ^ (this.installmentSeq >>> 32)));
		
		return hash;
    }
}